import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class ScaffoldPage extends StatelessWidget {
  const ScaffoldPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // 背景颜色
      backgroundColor: Colors.grey[100],
      // backgroundColor: Colors.grey[100],

      // 应用栏
      appBar: AppBar(
        title: const Text('Scaffold Full Example'),
        backgroundColor: Colors.blue,
        elevation: 4,
        centerTitle: true,
        leading: IconButton(
          icon: const Icon(Icons.menu),
          onPressed: () {},
        ),
        actions: [
          IconButton(
            icon: const Icon(Icons.search),
            onPressed: () {},
          ),
        ],
      ),

      // 页面主内容区域
      body: const Center(
        child: Text(
          'This is the body',
          style: TextStyle(fontSize: 20),
        ),
      ),

      // 悬浮按钮
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          debugPrint('FAB pressed');
        },
        tooltip: 'Add',
        child: const Icon(Icons.add),
      ),

      // FAB 位置
      floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,

      // 下方工具条（通常用于 FAB notch）
      bottomNavigationBar: BottomAppBar(
        shape: const CircularNotchedRectangle(),
        notchMargin: 6.0,
        color: Colors.blueGrey,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            IconButton(icon: const Icon(Icons.home), onPressed: () {}),
            IconButton(icon: const Icon(Icons.settings), onPressed: () {}),
          ],
        ),
      ),

      // 抽屉菜单（左侧）
      drawer: Drawer(
        child: ListView(
          padding: EdgeInsets.zero,
          children: const [
            DrawerHeader(
              decoration: BoxDecoration(color: Colors.blue),
              child: Text('Drawer Header'),
            ),
            ListTile(
              leading: Icon(Icons.person),
              title: Text('Profile'),
            ),
            ListTile(
              leading: Icon(Icons.settings),
              title: Text('Settings'),
            ),
          ],
        ),
      ),

      // 右侧抽屉
      endDrawer: Drawer(
        child: Center(child: Text('End Drawer')),
      ),

      // 键盘弹出时是否自动调整 body 高度（避免被遮挡）
      resizeToAvoidBottomInset: true,

      // 页面底部区域
      bottomSheet: Container(
        color: Colors.amber[100],
        height: 50,
        alignment: Alignment.center,
        child: const Text('Bottom Sheet Area'),
      ),

      // 页面浮动顶部提示条（如 snackBar）
      persistentFooterButtons: [
        ElevatedButton(onPressed: () {}, child: const Text('Footer Button 1')),
        ElevatedButton(onPressed: () {}, child: const Text('Footer Button 2')),
      ],

      // 页面状态控制（iOS 拖动返回、Drawer 控制等）
      drawerEnableOpenDragGesture: true,
      endDrawerEnableOpenDragGesture: true,
      primary: true,
      extendBody: false,
      extendBodyBehindAppBar: false,
    );
  }
}
